<template>
	<!-- 产品资源、行业服务 -->
	<view class="cpzy-list">
		<view class="row" v-for="(item, index) in cpzyData" :key="index" @click="handleClick(item)">
			<view class="left">
				<view class="title">{{ item.qyxqms }}</view>
				<view class="business">{{ item.zyyw }}</view>
				<view class="view-count">
					<uni-icons type="eye" size="14" color="#333"></uni-icons>
					<view class="uni-icons-text">{{ item.xyyfServiceLookList && item.xyyfServiceLookList.length || 0 }}
					</view>
				</view>
			</view>
			<view class="right">
				<image :src="item.qyjjXp" mode="aspectFit"></image>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		name: "Cpzy",
		data() {
			return {

			};
		},
		props: {
			cpzyData: {
				type: Array,
				default: () => []
			}
		},
		methods: {
			handleClick(item) {
				// 检查登录状态
				if (!this.$store.state.user.isLoggedIn) {
					uni.showToast({
						title: '请先登录',
						icon: 'none'
					});
					// 跳转到登录页面
					setTimeout(() => {
						uni.redirectTo({
							url: '/pages/login/login'
						});
					}, 1500);
					return;
				}
				uni.navigateTo({
					url: `/pages/service-provider-details/service-provider-details?guid=${item.guid}&text='产品资源'`
				});
			}
		}
	}
</script>

<style lang="less">
	.cpzy-list {
		padding: 10rpx 30rpx 20rpx;

		.row {
			position: relative;
			display: flex;
			padding: 20rpx 0 20rpx;

			.left {
				flex: 1;
				display: flex;
				flex-direction: column;
				margin-right: 30rpx;

				.title {
					font-size: 32rpx;
					color: #000;
					font-weight: bold;
					display: -webkit-box;
					-webkit-box-orient: vertical;
					-webkit-line-clamp: 1;
					overflow: hidden;
					text-overflow: ellipsis;
				}

				.business {
					font-size: 28rpx;
					color: #333;
					margin-top: 20rpx;
					min-height: 50rpx;
					display: -webkit-box;
					-webkit-box-orient: vertical;
					-webkit-line-clamp: 2;
					overflow: hidden;
					text-overflow: ellipsis;
				}

				.view-count {
					display: flex;
					align-items: center;
					justify-content: flex-start;
					font-size: 28rpx;
					color: #333;
					margin-top: 20rpx;

					.uni-icons-text {
						margin-left: 10rpx;
					}
				}

			}

			.right {
				flex-shrink: 0;
				height: 180rpx;
				display: flex;
				flex-direction: column;
				justify-content: center;
				image {
					width: 240rpx;
					height: 180rpx;
				}

			}
		}
	}
</style>